<template>
  <div>
    <div>
      <i class="iconfont icon-tishi"></i>
      <span style="margin-left: 10px" class="tip">您可以对该合同的合作供应商进行全阶段评价哦～</span>
    </div>
    <div class="company_wrap">
      <span class="icon-box">
        <i class="iconfont icon-jurassic_company"></i>
      </span>
      <span class="companyName">{{ enterpriseName }}</span>
      <label for="">
        综合评分：
        <span style="color: #fa7355"> --</span>
      </label>
    </div>
    <div style="margin-top: 30px" class="conbox-wrap">
      <bidding-evaluation
        :moreEvalua="true"
        :evaObj="biddObj"
        :bidid="biddId"
        :evaluateType="1"
        :isCon="true"
      ></bidding-evaluation>
    </div>
    <div style="margin-top: 20px" class="conbox-wrap">
      <bidding-evaluation
        :moreEvalua="true"
        :evaObj="conObj"
        :bidid="contractId"
        :evaluateType="2"
        :isCon="true"
      ></bidding-evaluation>
    </div>
    <div v-if="checkObj.checkProductQuality" style="margin-top: 20px" class="conbox-wrap">
      <bidding-evaluation
        :moreEvalua="true"
        :evaObj="checkObj"
        :bidid="contractId"
        :evaluateType="3"
        :isCon="true"
      ></bidding-evaluation>
    </div>
    <div class="evabtn">
      <el-button style="width: 130px" class="commonBtn1" @click="closeBtn"> 关闭 </el-button>
    </div>
  </div>
</template>

<script>
import BiddingEvaluation from '../../../../components/BiddingEvaluation.vue'
export default {
  components: { BiddingEvaluation },
  props: {
    contractId: {
      type: [Number, String],
      require: true
    },
    biddId: {
      type: [Number, String]
    }
  },
  data() {
    return {
      enterpriseName: '',
      biddObj: {},
      conObj: {},
      checkObj: {}
    }
  },
  beforeMount() {
    this.getData()
  },
  mounted() {},
  methods: {
    closeBtn() {
      this.$emit('closeBtn')
    },
    getData() {
      this.$https({
        method: 'post',
        url: '/evaluate/listAllEvaluateByContractId?contractId=' + this.contractId
      })
        .then(res => {
          if (res.code === 0) {
            let arr = JSON.parse(JSON.stringify(res.data.labels).replace(/id/g, 'labelId'))
            this.enterpriseName = res.data.enterpriseName
            this.biddObj = {
              biddingAbilityPerformance: res.data.biddingAbilityPerformance,
              biddingCooperationDegree: res.data.biddingCooperationDegree,
              biddingEnterpriseReputation: res.data.biddingEnterpriseReputation,
              selectedIabels: res.data.biddingLabelIds || [],
              biddingRationQuote: res.data.biddingRationQuote,
              biddingTruthQuote: res.data.biddingTruthQuote,
              labels: [...arr],
              enterpriseId: res.data.enterpriseId,
              evaluateContent: res.data.evaluateContent
            }
            this.conObj = {
              contractAbilityPerformance: res.data.contractAbilityPerformance,
              contractEnterpriseReputation: res.data.contractEnterpriseReputation,
              contractProductQuality: res.data.contractProductQuality,
              contractProjectCoordination: res.data.contractProjectCoordination,
              contractServiceAttitude: res.data.contractServiceAttitude,
              selectedIabels: res.data.contractLabelIds || [],
              labels: [...arr],
              enterpriseId: res.data.enterpriseId,
              evaluateContent: res.data.evaluateContent2
            }
            this.checkObj = {
              checkAbilityPerformance: res.data.checkAbilityPerformance,
              checkDeliveryAttitude: res.data.checkDeliveryAttitude,
              checkProductQuality: res.data.checkProductQuality,
              checkServiceAttitude: res.data.checkServiceAttitude,
              checkSupplyCycle: res.data.checkSupplyCycle,
              selectedIabels: res.data.checkLabelIds || [],
              labels: [...arr],
              enterpriseId: res.data.enterpriseId,
              evaluateContent: res.data.checkEvaluateContent
            }
          } else {
            this.$message.error(res.msg)
          }
        })
        .catch(err => {
          console.log(err)
        })
    }
  }
}
</script>
<style lang="less" scoped>
.icon-tishi {
  font-size: 16px;
  color: #fa7355;
}
.evabtn {
  margin: 40px 0 0;
  display: flex;
  justify-content: center;
}
.tip {
  font-size: 14px;
  font-weight: 400;
  color: #fa7355;
}
.company_wrap {
  display: flex;
  align-items: center;
  margin-top: 30px;
}
.icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #999999;
  margin-right: 10px;
}
.companyName {
  font-size: 18px;
  font-weight: 500;
  color: #333333;
  margin-right: 20px;
}
.conbox-wrap {
  border: 1px solid #d6d6d6;
  padding: 25px 40px 30px;
}
</style>
